<template>
  <div class="app-page">
    <!-- 头 -->
    <div class="app-header">
      <div class="app-title">
        <i :class="$route.meta.icon"></i> {{ $route.meta.title }}
      </div>
    </div>
    <div class="app-page-padding">
      <div class="app-section">
        <ul class="rs-background-origin">
          <li class="border-box">
            <h2>border-box</h2>
            <p>从border区域（含border）开始显示背景图像</p>
          </li>
          <li class="padding-box">
            <h2>padding-box</h2>
            <p>从padding区域（含padding）开始显示背景图像</p>
          </li>
          <li class="content-box">
            <h2>content-box</h2>
            <p>从content区域开始显示背景图像</p>
          </li>
        </ul>
      </div>
      <div class="app-section">
        <!-- bidirectional data binding（双向数据绑定） -->
        <codemirror v-model="code" :options="cmOptions"></codemirror>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'StyleButton',
  data () {
    return {
      code: `
// 背景原点
.rs-background-origin {
  .border-box p {
    background-origin: border-box;
  }
  .padding-box p {
    background-origin: padding-box;
  }
  .content-box p {
    background-origin: content-box;
  }
}
      `,
      cmOptions: {
        // codemirror options
        tabSize: 4,
        mode: 'sass',
        theme: 'darcula',
        lineNumbers: true,
        line: true
        // more codemirror options, 更多 codemirror 的高级配置...
      }
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
h1 {
  font-size: 20px;
}
h2 {
  font-size: 16px;
}
p {
  border: 10px dashed #666;
  width: 200px;
  height: 200px;
  padding: 20px;
  background: #aaa url("~@/assets/icon.png") no-repeat;
}

// 背景原点
.rs-background-origin {
  .border-box p {
    background-origin: border-box;
  }
  .padding-box p {
    background-origin: padding-box;
  }
  .content-box p {
    background-origin: content-box;
  }
}
</style>
